<?php

class AdminPublicAction extends Action {
	
	
	public function _initialize()
	{
		if (!session('admin'))
		{					
			$this->redirect("Login/index");		
		}
		
		if(session('adminId') != C('adminId')){
			if(MODULE_NAME != 'Index'){
				$check_access_uid = get_user_group(session('adminId'),'id');
				$check_access_group_rule = M('think_auth_group')->where(array('id'=>$check_access_uid))->find();
				$check_access_group_rule_arr = explode(',',$check_access_group_rule['rules']);
				if(!in_array(MODULE_NAME, $check_access_group_rule_arr)){
					$this->error("No permission!");
				}
			}
		}
		
		$systemConfig = include  './myApp/Conf/systemConfig.php';
		$this->assign("site", $systemConfig);
		$this->assign("loginName", session('admin'));	
	}	
	
	 public function getcity(){
		$this->allProvince = M('province')->select();
		$this->allCity = M('city')->select();
		$this->allArea = M('area')->select();
		/* echo "<pre>";
		var_dump($this->allProvince);die; */
	
		$this->e_allProvince = json_encode($this->allProvince);
		$this->e_allCity= json_encode($this->allCity);	
		$this->e_allArea= json_encode($this->allArea);
	}
}